import HttpAxios from "../../components/http/HttpAxios";

class PointService{

  baseUrl = process.env.POINT_SERVICE_URL;
  httpClient= new HttpAxios();

  queryPointUrl="/query/points/";

  queryRecordListUrl = "/query/records/";
  withdrawPointUrl ="/points/reward/withdraw";
  withdrawConsumePointUrl ="/points/consume/withdraw"

  queryByLikeNameUrl = "/query/activities/name/";

  queryByHostLikeNameUrl = "/query/activities/host/";
  countByUmIdUrl = "/query/records/group/um-id";
  countByUserGroupUrl = "/query/records/group/user-group";

  queryPoint(username:string,data,token:string,call){
    this.httpClient.getAndToken(this.baseUrl+this.queryPointUrl+username,data,token,call);
  }


  withdrawPoint(data,token:string,call){
    this.httpClient.postAndToken(this.baseUrl+this.withdrawPointUrl,data,token,call);
  }

  withdrawConsumePoint(data,token:string,call){
    this.httpClient.postAndToken(this.baseUrl+this.withdrawConsumePointUrl,data,token,call);
  }


  queryRecordList(username:string,data,token:string,call){
    this.httpClient.getAndToken(this.baseUrl+this.queryRecordListUrl+username,data,token,call);
  }

  queryByLikeName(activitiesName:string,data,token:string,call){
    this.httpClient.getAndToken(this.baseUrl+this.queryByLikeNameUrl+activitiesName,data,token,call);
  }

  queryByHostLikeName(activityName:string,host:string,token:string,call){
    this.httpClient.getAndToken(this.baseUrl+this.queryByHostLikeNameUrl+host+"/"+activityName,{},token,call);
  }

  countByUmId(data,token:string,call){
    this.httpClient.getAndToken(this.baseUrl+this.countByUmIdUrl,data,token,call);
  }

  countByUserGroup(data,token:string,call){
    this.httpClient.getAndToken(this.baseUrl+this.countByUserGroupUrl,data,token,call);
  }
}

export default PointService;
